import request, { download } from '@/utils/request'

// 计划列表
export function getStktakingList (query) {
  return request({
    url: '/function/stktaking/plan/list',
    method: 'get',
    params: query
  })
}
// 删除计划列表
export function DeleteStktaking (query) {
  return request({
    url: '/function/stktaking/plan/' + query,
    method: 'delete',
    // params: 
  })
}
// 计划详情
export function getChlidrenStktaking (query) {
  return request({
    url: '/function/stktaking/plan/' + query,
    method: 'get',
    // params: 
  })
}
// 新增计划
export function postStktaking (query) {
  return request({
    url: '/function/stktaking/plan',
    method: 'post',
    data: query
  })
}
// 修改计划
export function putStktaking (query) {
  return request({
    url: '/function/stktaking/plan',
    method: 'put',
    data: query
  })
}
//新增任务
export function postCreatedTask (query) {
  return request({
    url: '/function/stktaking/task',
    method: 'post',
    data: query
  })
}
//修改任务
export function putUpdateTask (query) {
  return request({
    url: '/function/stktaking/task',
    method: 'put',
    data: query
  })
}
// 根据部门ID获取设备信息列表
export function getbyDeptIdsList (query) {
  return request({
    url: '/function/equipment/account/list/byDeptIds',
    method: 'get',
    params: query
  })
}
// 盘点设备列表
export function getbyDeptIdsTaskList (query) {
  return request({
    url: '/function/stktaking/task/equipment/list',
    method: 'get',
    params: query
  })
}
// 删除任务
export function deleteTaskList (query) {
  return request({
    url: `/function/stktaking/task/${query
      .planId}/${query.taskId}`,
    method: 'delete',
  })
}
// 任务详情
export function getTaskList (query) {
  return request({
    url: `/function/stktaking/task/${query}`,
    method: 'get',
  })
}
// 生成盘点任务
export function putTaskGen (query) {
  return request({
    url: `/function/stktaking/plan/taskGen/${query}`,
    method: 'put',
  })
}

// 任务列表
export function getTaskGenList (query) {
  return request({
    url: `/function/stktaking/task/list`,
    method: 'get',
    params: query
  })
}
// 我的盘点
export function getMyTaskGenList (query) {
  return request({
    url: `/function/stktaking/task/my/list`,
    method: 'get',
    params: query
  })
}
// 我的盘点
export function putMstktakingTaskGenEquipment (query) {
  return request({
    url: `/function/stktaking/task/equipment`,
    method: 'put',
    data: query
  })
}
// 下载
/**
 * 
 * @param {*} data //入参
 * @param {*} filename //下载文件名称以及文件后缀为文件类型
 * @returns 
 */
export function downloadexport (data, filename) {
  return download(
    '/function/stktaking/task/equipment/export',
    data,
    filename
  )
}
// 结束盘点
export function putStktakingFinish (query) {
  return request({
    url: `/function/stktaking/task/end`,
    method: 'put',
    data: query
  })
}
// 开始平账
export function putStktakingStart (query) {
  return request({
    url: `/function/stktaking/task/account`,
    method: 'put',
    data: query
  })
}
//开始盘点
export function putStartTask (query) {
  return request({
    url: `/function/stktaking/task/start`,
    method: 'put',
    data: query
  })
}